#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project ：Employment_class 
@File    ：06_gevent版服务器.py
@IDE     ：PyCharm 
@Author  ：XiaoDengYa
@Date    ：2021/7/5/005 20:14 
"""

import gevent

def f(n):
    for i in range(n):
        print(gevent.getcurrent(),i)
        gevent.sleep(1) # 在这里停止时则把任务交给下个协程做

if __name__ == '__main__':
    g1 = gevent.spawn(f,5)
    g2 = gevent.spawn(f, 5)
    g3 = gevent.spawn(f, 5)
    g1.join()
    g2.join()
    g3.join()
